package com.zpkj.portal.utils;

public class EnumUtil {

	/***
	 * 默认值
	 *
	 */
	public enum defaultVal {
		SUCCESS("0"),FAIL("1");
		private String val;

		private defaultVal(String val) {
			this.val = val;
		}

		public String getVal() {
			return this.val;
		}
	}

	/***
	 * 0-是 1-否cross-domain
	 * 
	 * @author thinkpad
	 *
	 */
	public enum status {
		NO(1), YES(0);
		private int val;

		private status(int val) {
			this.val = val;
		}

		public Short getVal() {
			return new Short(String.valueOf(this.val));
		}
	}

	public enum crossDomain {
		YES("H5跨域", "0"), NO("H5非跨域", "1");
		// 成员变量
		private String name;
		private String index;

		// 构造方法
		private crossDomain(String name, String index) {
			this.name = name;
			this.index = index;
		}

		// 普通方法
		public static String getName(String index) {
			for (PayType c : PayType.values()) {
				if (c.getIndex().equals(index)) {
					return c.name;
				}
			}
			return null;
		}

		// get set 方法
		public String getName() {
			return name;
		}

		public void setName(String name) {
			this.name = name;
		}

		public String getIndex() {
			return index;
		}

		public void setIndex(String index) {
			this.index = index;
		}
	}

	// 交易类型 1CZ-充值 2GM-购买普通方案 3购买DIY方案 4BC-包次 5BY-包月 6AUT-购买延长站主福利期 7YL-盈利计划 8 宝币充值
	public enum OrderType {
		CZ("CZ", "1"), GM("GM", "2"), DIY("DIY", "3"), BC("BC", "4"), BY("BY", "5"),AUTH("AUTH", "6"),YL("YL","7"),BBCZ("BBCZ","8");
	
		private String name;
		private String index;

		private OrderType(String name, String index) {
			this.name = name;
			this.index = index;
		}

		public static String getName(String index) {
			for (OrderType c : OrderType.values()) {
				if (c.getIndex().equals(index)) {
					return c.name;
				}
			}
			return null;
		}

		public String getName() {
			return name;
		}

		public void setName(String name) {
			this.name = name;
		}

		public String getIndex() {
			return index;
		}

		public void setIndex(String index) {
			this.index = index;
		}
	}

	// 支付方式  1支付宝 2微信 3钱包 4银行卡 5包次 6包月 7苹果内购 8其他
	public enum PayType {

		ALIPAY("支付宝", "1"), WXPAY("微信", "2"), BALANCEPAY("余额", "3"), UNIONPAY("银行卡", "4") , BC("包次","5"), BY("包月","6"), IAP("苹果内购","7"), OTHER("苹果内购","8");
		private String name;
		private String index;

		private PayType(String name, String index) {
			this.name = name;
			this.index = index;
		}

		public static String getName(String index) {
			for (PayType c : PayType.values()) {
				if (c.getIndex().equals(index)) {
					return c.name;
				}
			}
			return null;
		}

		public String getName() {
			return name;
		}

		public void setName(String name) {
			this.name = name;
		}

		public String getIndex() {
			return index;
		}

		public void setIndex(String index) {
			this.index = index;
		}
	}

	// 支付状态
	public enum PayStatus {

		WAIT("待支付", "1"), PROCESSING("支付平台处理中", "2"), SUCCESS("支付成功", "3"), FAIL("支付失败", "4");
		private String name;
		private String index;

		private PayStatus(String name, String index) {
			this.name = name;
			this.index = index;
		}

		public static String getName(String index) {
			for (PayStatus c : PayStatus.values()) {
				if (c.getIndex().equals(index)) {
					return c.name;
				}
			}
			return null;
		}

		public String getName() {
			return name;
		}

		public void setName(String name) {
			this.name = name;
		}

		public String getIndex() {
			return index;
		}

		public void setIndex(String index) {
			this.index = index;
		}
	}
	// public static void main(String args[]){
	// System.out.println(EnumUtil.PayType.BUY.getIndex());
	//
	// }
}
